FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

WORKDIR /src
COPY ["src/Choucius.Boilerplate9.Web.Host/Choucius.Boilerplate9.Web.Host.csproj", "src/Choucius.Boilerplate9.Web.Host/"]
COPY ["src/Choucius.Boilerplate9.Web.Core/Choucius.Boilerplate9.Web.Core.csproj", "src/Choucius.Boilerplate9.Web.Core/"]
COPY ["src/Choucius.Boilerplate9.Application/Choucius.Boilerplate9.Application.csproj", "src/Choucius.Boilerplate9.Application/"]
COPY ["src/Choucius.Boilerplate9.Core/Choucius.Boilerplate9.Core.csproj", "src/Choucius.Boilerplate9.Core/"]
COPY ["src/Choucius.Boilerplate9.EntityFrameworkCore/Choucius.Boilerplate9.EntityFrameworkCore.csproj", "src/Choucius.Boilerplate9.EntityFrameworkCore/"]
WORKDIR "/src/src/Choucius.Boilerplate9.Web.Host"
RUN dotnet restore 

WORKDIR /src
COPY ["src/Choucius.Boilerplate9.Web.Host", "src/Choucius.Boilerplate9.Web.Host"]
COPY ["src/Choucius.Boilerplate9.Web.Core", "src/Choucius.Boilerplate9.Web.Core"]
COPY ["src/Choucius.Boilerplate9.Application", "src/Choucius.Boilerplate9.Application"]
COPY ["src/Choucius.Boilerplate9.Core", "src/Choucius.Boilerplate9.Core"]
COPY ["src/Choucius.Boilerplate9.EntityFrameworkCore", "src/Choucius.Boilerplate9.EntityFrameworkCore"]
WORKDIR "/src/src/Choucius.Boilerplate9.Web.Host"
RUN dotnet publish -c Release -o /publish --no-restore

FROM mcr.microsoft.com/dotnet/aspnet:8.0
EXPOSE 80
WORKDIR /app
COPY --from=build /publish .
ENTRYPOINT ["dotnet", "Choucius.Boilerplate9.Web.Host.dll"]
